package me.littlesquid.bettertp;

import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;

import java.io.File;

public class catchdeath implements Listener {
    @EventHandler
    public void ondeath(PlayerDeathEvent event){
        File file=new File(me.littlesquid.bettertp.Bettertp.getProvidingPlugin(me.littlesquid.bettertp.Bettertp.class).getDataFolder(),"data.yml");
        FileConfiguration data= YamlConfiguration.loadConfiguration(file);
        Location location=event.getEntity().getLocation();
        FileManager.savedeathlocation(location,data,event.getEntity().getName());
        FileManager.reloadfile(data,file);
    }
}
